<template>

    <d2-container type="card">





        <template slot="header">季度报表</template>
        

        <div class="d2-mb" style="display: block;width: 100%;position: relative;" >
           

            <el-button type="primary" @click="exportExcel">
                <d2-icon name="download"/>
                导出excel
            </el-button>
            <el-button type="primary" @click="exportQuarter">
                <d2-icon name="download"/>
                导出员工季度数据
            </el-button>
        <!-- <el-col :span="6" style="float: right"> -->
          <el-select
            style="position: absolute;right:3vw;top:0vw;z-index: 100"
            v-model="school"
            filterable
            placeholder="所属校区"
            @change="schoolSelected"
            v-if="headquarter"
          >
            <el-option
              v-for="item in schoolList"
              :key="item._id"
              :label="item.name"
              :value="item._id"
            ></el-option>
          </el-select>

           <!-- <el-button type="primary" @click="changeDisplayType" style="position:absolute;right:3vw;top:3vw;z-index: 100">
            {{(display == 1) ? '图表' : '表格' }}
            </el-button> -->
        <!-- </el-col> -->

        </div>

        <el-form :inline="true" :model="queryOption" ref="dataSearch">

            <el-form-item>
                <el-date-picker
                        v-model="queryOption.year"
                        type="year"
                        placeholder="选择日期时间"
                        style='width: 150px'
                        >
                </el-date-picker>
            </el-form-item>

            
            <el-form-item style='width: 150px'>

            <el-select
                            v-model="queryOption.quarter"
                            >
                        <el-option
                                v-for="item in quarters"
                                :label="item.name"
                                :value="item.value"
                        ></el-option>
                    </el-select>
                    </el-form-item>
                    <el-form-item style='width: 150px'>

            
                <el-button type="primary" @click="formSubmit">
                    <d2-icon name="search"/>
                    生成
                </el-button>
            </el-form-item>
        </el-form>
        <div v-if="studentMissNumber != undefined">
         <el-row :span="6" style="margin-top:10px;height:40px"><span style='width:2px;height:100%;background-color:rgb(52, 178, 211) ;color: rgb(52, 178, 211);margin-right: 3px'>_</span>收支统计
        </el-row>
	<el-row style='background-color:white;width: 100%;height:310px;position: relative;border-width: 1px;border-color: #D4DFE5;border-style: solid;margin-bottom:20px' >


            <div style="width: 100%;position: relative;height:130px;display: block">
	             
                	<div style="position: relative;left:100px;top:10px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">课程收入</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{courseIncome}}</div>
                	</div>
					<div style="position: relative;left:100px;top:40px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">教材收入</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{productIncome}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:70px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">其他收入</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{otherIncome}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:100px;color:#000000;display: block">
                		<div style="position: absolute;font-size:16px;left:0%">小计</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{parseFloat(parseFloat(otherIncome) + parseFloat(courseIncome) + parseFloat(productIncome)).toFixed(1)}}元</div>
                	</div> 
            </div>
             <div style="width: 100%;position: relative;height: 1px;background-color: #D4DFE5"></div>

            <div style="width: 100%;position: relative;height:130px;display: block">

                	<div style="position: relative;left:100px;top:10px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">老师提成支出</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">-{{teacherIncome}}</div>
                	</div>
                    <div style="position: relative;left:100px;top:40px;color:#98A0A7;display: block">
                        <div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">老师流失罚款收入</div>
                        <div style="position: absolute;font-size:16px;left:15%;text-align: right">{{teacherPenalty}}</div>
                    </div>
					<div style="position: relative;left:100px;top:70px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">其他支出</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">-{{otherExpense}}</div>
                	</div>
                	
                	<div style="position: relative;left:100px;top:100px;color:#000000;display: block">
                		<div style="position: absolute;font-size:16px;left:0%">小计</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">-{{parseFloat(parseFloat(teacherIncome) + parseFloat(otherExpense) - parseFloat(teacherPenalty)).toFixed(1)}}元</div>
                	</div> 
            	</div>
                  <div style="width: 100%;position: relative;height: 1px;background-color: #D4DFE5"></div>
            <div style="width: 100%;position: relative;height:40px;display: block">

                	<div style="position: relative;left:100px;top:10px;color:#000000;display: block">
                		<div style="position: absolute;font-size:16px;left:0%">总计</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{parseFloat(parseFloat(productIncome) + parseFloat(courseIncome) + parseFloat(otherIncome) -parseFloat(teacherIncome) - parseFloat(otherExpense) + parseFloat(teacherPenalty)).toFixed(1)}}元</div>
                	</div> 
            	</div>

           

        </el-row>

         <el-row :span="6" style="margin-top:10px;height:40px"><span style='width:2px;height:100%;background-color:rgb(52, 178, 211) ;color: rgb(52, 178, 211);margin-right: 3px'>_</span>学生和课程数据
        </el-row>
	<el-row style='background-color:white;width: 100%;height:310px;position: relative;border-width: 1px;border-color: #D4DFE5;border-style: solid;margin-bottom:20px' >


            <div style="width: 100%;position: relative;display: block">
	             
                	<div style="position: relative;left:100px;top:10px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">新生数量</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{newStudentCount}}</div>
                	</div>
					<div style="position: relative;left:100px;top:40px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">新课程订单数量</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{newOrdersCount}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:70px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">续课学生数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{studentContinueNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:100px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">流失学生数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{studentMissNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:130px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">流失率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{loseRate}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:160px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">续课率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{continueRate}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:190px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">上课次数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{totalClassOrder}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:220px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">上课人次</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{classStudentIn}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:250px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">缺席人次</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{classStudentMiss}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:280px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">出勤率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{classRate}}</div>
                	</div>

            </div>
        </el-row>


         <el-row :span="6" style="margin-top:10px;height:40px"><span style='width:2px;height:100%;background-color:rgb(52, 178, 211) ;color: rgb(52, 178, 211);margin-right: 3px'>_</span>考勤数据
        </el-row>
	<el-row style='background-color:white;width: 100%;height:290px;position: relative;border-width: 1px;border-color: #D4DFE5;border-style: solid;margin-bottom:20px' >


            <div style="width: 100%;position: relative;display: block">
	             
                	<div style="position: relative;left:100px;top:10px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">应打卡人次</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRecordData.supposeNumber}}</div>
                	</div>
					<div style="position: relative;left:100px;top:40px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">实打卡人次</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRecordData.actualNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:70px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">打卡出勤率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRate}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:100px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">缺卡次数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRecordData.missNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:130px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">缺卡率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{missRate}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:160px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">迟到次数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRecordData.lateNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:190px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">迟到率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{lateRate}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:220px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">早退次数</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{workRecordData.earlyNumber}}</div>
                	</div>
                	<div style="position: relative;left:100px;top:250px;color:#98A0A7;display: block">
                		<div style="position: absolute;font-size:16px;left:0%;color: #98A0A7">早退率</div>
                		<div style="position: absolute;font-size:16px;left:15%;text-align: right">{{earlyRate}}</div>
                	</div>
            </div>
        </el-row>
 <el-row :span="6" style="margin-top:10px;height:40px"><span style='width:2px;height:100%;background-color:rgb(52, 178, 211) ;color: rgb(52, 178, 211);margin-right: 3px'>_</span>续课列表
        </el-row>
    <el-row style='background-color:white;width: 100%;position: relative;border-width: 1px;border-color: #D4DFE5;border-style: solid;margin-bottom:20px' >
        <el-table :data="continueOrders" border style="width: 100%">

            <el-table-column label="姓名">
                 <template slot-scope='scope'>
                    {{scope.row.student == undefined ? '' : scope.row.student.name}}
                </template>
            </el-table-column>
            <el-table-column  label="性别">
                <template slot-scope='scope'>
                    {{scope.row.genderText}}
                </template>
            </el-table-column>
            <el-table-column  label="班级">
                <template slot-scope='scope'>
                    {{scope.row.class == null ? '未知' : scope.row.class.name}}
                </template>
            </el-table-column>
            <el-table-column  label="授课老师">
                <template slot-scope='scope'>
                    {{scope.row.class == undefined ? '' : scope.row.class.teacher.name}}
                </template>
            </el-table-column>
            <el-table-column  label="教务老师">
                <template slot-scope='scope'>
                     {{scope.row.class == undefined ? '' : scope.row.class.registrar.name}}
                </template>
            </el-table-column>
            <el-table-column  label="订单金额(元)">
                <template slot-scope='scope'>
                    {{scope.row.total - scope.row.discount}}
                </template>
            </el-table-column>
            <el-table-column  label="订单时间">
                <template slot-scope='scope'>
                    {{scope.row.createdAtText}}
                </template>
            </el-table-column>
            <!-- <el-table-column prop="class" label="当前负责班级"></el-table-column> -->
            <el-table-column fixed="right" label="操作">
                <template slot-scope="scope">
                    <el-button @click="detailClick(scope.row)" type="text" size="small">查看详情</el-button>
                </template>
            </el-table-column>
        </el-table>
</el-row>

<el-row :span="6" style="margin-top:10px;height:40px"><span style='width:2px;height:100%;background-color:rgb(52, 178, 211) ;color: rgb(52, 178, 211);margin-right: 3px'>_</span>流失列表
        </el-row>
    <el-row style='background-color:white;width: 100%;position: relative;border-width: 1px;border-color: #D4DFE5;border-style: solid;margin-bottom:20px' >
        <el-table :data="missOrders" border style="width: 100%">

            <el-table-column label="姓名">
                 <template slot-scope='scope'>
                    {{scope.row.student == undefined ? '' : scope.row.student.name}}
                </template>
            </el-table-column>
            <el-table-column  label="性别">
                <template slot-scope='scope'>
                    {{scope.row.genderText}}
                </template>
            </el-table-column>
            <el-table-column  label="班级">
                <template slot-scope='scope'>
                    {{scope.row.class.name}}
                </template>
            </el-table-column>
            <el-table-column  label="授课老师">
                <template slot-scope='scope'>
                    {{scope.row.class == undefined ? '' : scope.row.class.teacher.name}}
                </template>
            </el-table-column>
            <el-table-column  label="教务老师">
                <template slot-scope='scope'>
                    {{scope.row.class.registrar.name}}
                </template>
            </el-table-column>
            <el-table-column  label="订单金额(元)">
                <template slot-scope='scope'>
                    {{scope.row.total - scope.row.discount}}
                </template>
            </el-table-column>
            <el-table-column  label="订单时间">
                <template slot-scope='scope'>
                    {{scope.row.createdAtText}}
                </template>
            </el-table-column>
            <!-- <el-table-column prop="class" label="当前负责班级"></el-table-column> -->
            <el-table-column fixed="right" label="操作">
                <template slot-scope="scope">
                    <el-button @click="detailClick(scope.row)" type="text" size="small">查看详情</el-button>
                </template>
            </el-table-column>
        </el-table>
</el-row>

    </div>

    </d2-container>
</template>

<script>
    import request from "@/plugin/axios";
        import { mapState } from "vuex";
        import formatTime from '@/libs/util.formatTime'
                          import excel from "@/libs/util.excel"

    function getTodayDate() {
        let day1 = new Date();
        let s1 = day1.getFullYear()+"-" + addZero(day1.getMonth()+1) + "-" + addZero(day1.getDate()) + ' ' + addZero(day1.getHours()) + ':' + addZero(day1.getMinutes()) + ':00';
        // s1 = '2019-09-21 17:00'
        return s1
    }

    function getYesterdayDate() {
        let day1 = new Date();
        day1.setDate(day1.getDate() - 1);
        let s1 = day1.getFullYear()+"-" + addZero(day1.getMonth()+1) + "-" + addZero(day1.getDate());
        return s1
    }


    function getLastMonthDate() {
        let day1 = new Date();
        day1.setMonth(day1.getMonth() - 1);
        let s1 = day1.getFullYear()+"-" + addZero(day1.getMonth()+1) + "-" + addZero(day1.getDate());
        return s1
    }

    function getLastYearDate() {
        let day1 = new Date();
        day1.setFullYear(day1.getFullYear() - 1);
        let s1 = day1.getFullYear()+"-" + addZero(day1.getMonth()+1) + "-" + addZero(day1.getDate());
        return s1
    }

    function addZero(a){
        return a < 10 ? '0' + a : a
    }

    export default {
        data() {
            return {
                filename: __filename,
                headquarter : false,
                schoolList : [],
                display : 1,
                courseIncome:undefined,
                productIncome : undefined,
                teacherIncome : undefined,
                otherIncome : undefined,
                otherExpense : undefined,
                workRecordData : undefined,
                classStudentMiss : undefined,
                classStudentIn : undefined,
                studentMissNumber : undefined,
                studentContinueNumber : undefined,
                newStudentCount : undefined,
               	newOrdersCount : undefined,
               	totalClassOrder : undefined,
                loseRate : undefined,
                continueRate : undefined,
                classRate : undefined,
                workRate :  undefined,
                missRate : undefined,
                lateRate : undefined,
                earlyRate : undefined,
                continueOrders : [],
                missOrders : [],
                filterType : [{name:'时长：日',value:'day'},{name:'时长：周',value:'week'},{name:'时长：月',value:'month'},{name:'时长：年','value':'year'}],
                quarters : [{name:'一季度',value:'0'},{name:'二季度',value:'1'},{name:'三季度',value:'2'},{name:'四季度',value:'3'}],

                exportData:{
columns: undefined,
                    data: undefined,
                    size: 'mini',
                    stripe: true,
                    border: true
                },
                workRecordData : {},
                queryOption:{
                    start_time:undefined,
                    end_time:undefined,
                    period : 'day',
                    payWay : -1,
                    year : new Date(),

                },
            }
        },

                  computed:{
    ...mapState('d2admin/user',['info'])
  },


        methods: {

            formSubmit(){

                this.getInitData(this.school)
            },

            setYesterday(){

                this.queryOption.start_time = getYesterdayDate()

                this.queryOption.end_time = getTodayDate()

                this.getInitData(this.school)
            },

            setLastMonth(){

                this.queryOption.start_time = getLastMonthDate()

                this.queryOption.end_time = getTodayDate()

                this.getInitData(this.school)

            },
            setLastYear(){


                this.queryOption.start_time = getLastYearDate()

                this.queryOption.end_time = getTodayDate()

                this.getInitData(this.school)
            },

            detailClick(e){
                this.$router.push({path:'/student-detail?id=' + e.student._id})
                },

            getInitData(school) {
                if (this.queryOption.year == undefined){
                    this.$alert('','请选择年份')
                    return false
                }
                if (this.queryOption.quarter == undefined){
                    this.$alert('','请选择季度')
                    return false
                }
                var data = {start_time: this.queryOption.start_time,end_time: this.queryOption.end_time,period:this.queryOption.period}
                if ((school != undefined) && (school != 'all')){
                    data.school = this.school
                }
                data.year = this.queryOption.year.getFullYear()
                data.quarter = this.queryOption.quarter
     
                request({
                    url: "/data/getquarterreport",
                    method: "post",
                    data:data

                }).then(res => {
                    if(res.code==200){
                        
                    	this.totalClassOrder = res.data.totalClassOrder
                    	this.studentMissNumber = res.data.studentMissNumber
                    	this.studentContinueNumber = res.data.studentContinueNumber
                    	this.newStudentCount = res.data.newStudentCount
                    	this.newOrdersCount = res.data.newOrdersCount
                    	this.classStudentIn = res.data.classStudentIn
                    	this.classStudentMiss = res.data.classStudentMiss
                    	this.courseIncome = parseFloat(res.data.courseIncome.map(function(e){return e.total - e.discount}).reduce(function(a,b){return a + b})).toFixed(2)
                    	this.productIncome =  parseFloat(res.data.productIncome.map(function(e){return e.total - e.discount}).reduce(function(a,b){return a + b})).toFixed(2)
                    	this.otherIncome =  parseFloat(res.data.otherIncome.map(function(e){return e.total}).reduce(function(a,b){return a + b})).toFixed(2)
                    	this.otherExpense =  parseFloat(res.data.otherIncome.map(function(e){return e.expense}).reduce(function(a,b){return a + b})).toFixed(2)
                    	this.teacherIncome =  parseFloat(res.data.teacherIncome.map(function(e){return e.commission0 + e.commission1 + e.commission2 + e.commission3}).reduce(function(a,b){return a + b})).toFixed(2)
                        this.teacherPenalty =  parseFloat(res.data.teacherIncome.map(function(e){return e.commission4}).reduce(function(a,b){return a + b})).toFixed(2)
                    	this.workRecordData = res.data.workRecordData
                    	this.workRecordData.actualNumber = res.data.workRecordData.map(function(e){return e.actualNumber}).reduce(function(a,b){return a + b}) * 2
                    	this.workRecordData.supposeNumber = res.data.workRecordData.map(function(e){return e.supposeNumber}).reduce(function(a,b){return a + b}) * 2
                    	this.workRecordData.missNumber = res.data.workRecordData.map(function(e){return e.missNumber}).reduce(function(a,b){return a + b})
                    	this.workRecordData.outNumber = res.data.workRecordData.map(function(e){return e.outNumber}).reduce(function(a,b){return a + b})
                    	this.workRecordData.totalHours = res.data.workRecordData.map(function(e){return e.totalHours}).reduce(function(a,b){return a + b})
                    	this.workRecordData.earlyNumber = res.data.workRecordData.map(function(e){return e.earlyNumber}).reduce(function(a,b){return a + b})
                    	this.workRecordData.lateNumber = res.data.workRecordData.map(function(e){return e.lateNumber}).reduce(function(a,b){return a + b})
                    	this.workRecordData.earlyMinutes = res.data.workRecordData.map(function(e){return e.earlyMinutes}).reduce(function(a,b){return a + b})
                    	this.workRecordData.inNumber = res.data.workRecordData.map(function(e){return e.inNumber}).reduce(function(a,b){return a + b})
                    	this.workRecordData.lateMinutes = res.data.workRecordData.map(function(e){return e.lateMinutes}).reduce(function(a,b){return a + b})
                       

                       if (this.studentContinueNumber + this.studentMissNumber == 0){
                        this.loseRate = '暂无数据'
                        this.continueRate = '暂无数据'
                       }
                       else{
                        this.loseRate = Math.round(this.studentMissNumber / (this.studentContinueNumber + this.studentMissNumber) * 10000) / 100  + '%'
                        this.continueRate = Math.round(this.studentContinueNumber / (this.studentContinueNumber + this.studentMissNumber) * 10000) / 100  + '%'
                       }

                       if (this.classStudentIn + this.classStudentMiss == 0){
                        this.classRate = '暂无数据'
                       }
                       else{
                        this.classRate = Math.round(this.classStudentIn / (this.classStudentIn + this.classStudentMiss)  * 10000) / 100  + '%'
                       }
                       console.log(this.workRecordData.supposeNumber)
                       if (this.workRecordData.supposeNumber != 0){
                        this.workRate = Math.round(this.workRecordData.actualNumber / this.workRecordData.supposeNumber * 10000) / 100 + '%'
                        this.missRate = Math.round(this.workRecordData.missNumber / this.workRecordData.supposeNumber * 10000) / 100 + '%'
                        this.lateRate = Math.round(this.workRecordData.lateNumber / this.workRecordData.supposeNumber * 10000) / 100 + '%'
                        this.earlyRate = Math.round(this.workRecordData.earlyNumber / this.workRecordData.supposeNumber * 10000) / 100 + '%'
                       }
                       else{
                        this.workRate = '暂无数据'
                        this.missRate = '暂无数据'
                        this.lateRate = '暂无数据'
                        this.earlyRate = '暂无数据'
                       }
                       console.log(res.data.missOrders,'dadsdo')
                       res.data.missOrders.forEach(e=>{
                        e.createdAtText = formatTime.formatDate(new Date(e.createdAt))
                       })
                       res.data.continueOrders.forEach(e=>{
                        e.createdAtText = formatTime.formatDate(new Date(e.createdAt))
                       })
                       this.missOrders = res.data.missOrders
                       this.continueOrders = res.data.continueOrders
                       this.missOrders.forEach(e=>{
                        e.genderText = (e.student.gender == 0 ? '男'  : '女')
                        e.classText = (e.class == undefined ? '' : e.class.name)
                        e.teacherText = (e.class == undefined ? '' : e.class.teacher.name)
                        e.registrarText = (e.class == undefined ? '' : e.class.registrar.name)
                        e.studentText = (e.student == undefined ? '' : e.student.name)
                        e.totalText = (e.total - e.discount)
                        e.timeText = formatTime.formatDate(e.createdAt)
                       })

                       this.continueOrders.forEach(e=>{
                        e.genderText = (e.student.gender == 0 ? '男'  : '女')
                        e.classText = (e.class == undefined ? '' : e.class.name)
                        e.teacherText = (e.teacher == undefined ? '' : e.teacher.name)
                        e.registrarText = (e.registrar == undefined ? '' : e.registrar.name)
                        e.studentText = (e.student == undefined ? '' : e.student.name)
                        e.totalText = (e.total - e.discount)
                        e.timeText = formatTime.formatDate(e.createdAt)
                       })
                       
                       
                        
                    }})
            },
          
            exportExcel() {
            	if (this.studentMissNumber == undefined){
            		return false
            	}


                                          excel.export([{'label':'课程收入','prop':'courseIncome'},{'label':'教材收入','prop':'productIncome'},{'label':'其他收入','prop':'otherIncome'},{'label':'老师提成','prop':'teacherIncome'},{'label':'老师流失罚款收入','prop':'teacherPenalty'},{'label':'其他支出','prop':'otherExpense'},{'label':'营收总计','prop':'totalIncome'},{'label':'新生数量','prop':'newStudentCount'},{'label':'新订单数量','prop':'newOrdersCount'},{'label':'续课学生数','prop':'studentContinueNumber'},{'label':'流失学生数','prop':'studentMissNumber'},{'label':'流失率','prop':'studentMissPercentage'},{'label':'续课率','prop':'studentContinuePercentage'},{'label':'上课次数','prop':'totalClassOrder'},{'label':'上课人次','prop':'classStudentIn'},{'label':'缺席人次','prop':'classStudentMiss'},{'label':'上课出勤率','prop':'classPercentage'},{'label':'应打卡人次','prop':'supposeNumber'},{'label':'实打卡人次','prop':'actualNumber'},{'label':'打卡出勤率','prop':'actualPercentage'},{'label':'缺卡次数','prop':'missNumber'},{'label':'缺卡率','prop':'missPercentage'},{'label':'迟到次数','prop':'lateNumber'},{'label':'迟到率','prop':'latePercentage'},{'label':'早退次数','prop':'earlyNumber'},{'label':'早退率','prop':'earlyPercentage'}],[{courseIncome:this.courseIncome,productIncome:this.productIncome,otherExpense:this.otherExpense,otherIncome:this.otherIncome,teacherIncome:this.teacherIncome,teacherPenalty:this.teacherPenalty,totalIncome:(this.courseIncome + this.productIncome + this.otherIncome - this.otherExpense - this.teacherIncome + this.teacherPenalty), newStudentCount : this.newStudentCount, newOrdersCount:this.newOrdersCount,studentContinueNumber : this.studentContinueNumber, studentMissNumber : this.studentMissNumber, studentMissPercentage : this.studentMissNumber / (this.studentMissNumber + this.studentContinueNumber) * 100,studentContinuePercentage : this.studentContinueNumber / (this.studentMissNumber + this.studentContinueNumber) * 100,totalClassOrder : this.totalClassOrder, classStudentIn : this.classStudentIn, classStudentMiss : this.studentMissNumber,classPercentage : (this.classStudentIn / (this.classStudentIn + this.classStudentMiss)),supposeNumber : this.workRecordData.supposeNumber * 2 , actualNumber : this.workRecordData.actualNumber * 2, actualPercentage : this.workRecordData.actualNumber / this.workRecordData.supposeNumber,missNumber : this.workRecordData.missNumber, missPercentage : this.workRecordData.missNumber / this.workRecordData.supposeNumber * 50 , lateNumber:this.workRecordData.lateNumber , latePercentage : this.workRecordData.lateNumber / this.workRecordData.supposeNumber * 50,earlyNumber : this.workRecordData.earlyNumber , earlyPercentage : this.workRecordData.earlyNumber / this.workRecordData.supposeNumber * 50}],this.queryOption.year.getFullYear() + '年' + this.queryOption.quarter + '季度报表' + '(' + this.schoolname + ')')
                                          
                                          excel.export([{label:'学生','prop':'studentText'},{label:'性别','prop':'genderText'},{label:'班级','prop':'classText'},{label:'授课老师','prop':'teacherText'},{label:'教务老师','prop':'registrarText'},{label:'订单金额(元)','prop':'totalText'},{label:'时间',prop:'timeText'}],[{label:'学生','prop':'studentText'},{label:'性别','prop':'genderText'},{label:'班级','prop':'classText'},{label:'授课老师','prop':'teacherText'},{label:'教务老师','prop':'registrarText'},{label:'订单金额(元)','prop':'totalText'},{label:'时间',prop:'timeText'}],this.queryOption.year.getFullYear() + '年' + this.queryOption.quarter + '季度续课订单列表' + '(' + this.schoolname + ')')


            },

            exportQuarter(){
                if (this.queryOption.quarter == undefined){
                    this.$alert('','请选择季度')
                    return false
                }
                let data = {}
                data.school = this.school
                data.quarter = this.queryOption.quarter
                data.year = this.queryOption.year.getFullYear()
                request({
                    url: "/data/getQuarterDetail",
                    method: "post",
                    data:data

                }).then(res => {
                    if(res.code==200){
                        // staffs data
                        let quarters = []
                        for (var i = 1 ; i < 4; i++){
                            quarters.push(this.queryOption.quarter * 3 + i)
                        }
                        let schoolData = res.data.filter(e=>{return e.staff == null})
                        let teacherData = res.data.filter(e=>{return ((e.isTeacher == 1) && (e.staff != null))})
                        let registrarData = res.data.filter(e=>{return ((e.isTeacher == 0) && (e.staff != null))})
                        let output = [[data.year + '年'+ (parseInt(data.quarter) + 1)+ '季度' + '续报']]
                        output.push(['姓名'])
                        output.push([''])
                        output.push([quarters[0] +  '月'])
                        output.push([quarters[1] +  '月'])
                        output.push([quarters[2] +  '月'])
                        output.push(['合计'])
                        output.push([])
                        output.push([data.year + '年'+(parseInt(data.quarter) + 1) + '季度' + '出勤']) 
                        output.push(['姓名'])
                        output.push([''])
                        output.push([quarters[0] +  '月'])
                        output.push([quarters[1] +  '月'])
                        output.push([quarters[2] +  '月'])
                        output.push(['合计'])
                        output.push([])
                        output.push([data.year + '年'+(parseInt(data.quarter) + 1) + '季度' + '转卡']) 
                        output.push(['姓名'])
                        output.push([''])
                        output.push([quarters[0] +  '月'])
                        output.push([quarters[1] +  '月'])
                        output.push([quarters[2] +  '月'])
                        output.push(['合计'])
                        output.push([])
                        output.push([data.year + '年'+(parseInt(data.quarter)+ 1)+ '季度' + '带班人数']) 
                        output.push(['姓名'])
                        output.push([quarters[0] +  '月'])
                        output.push([quarters[1] +  '月'])
                        output.push([quarters[2] +  '月'])
                        output.push(['平均人数'])
                        output.push([])

                        let merge = []
                        let teachers = []
                        let registrars = []
                        for (var i = 0 ; i < teacherData.length ;i++){
                            if (teachers.indexOf(teacherData[i].staff._id) == -1){
                                teachers.push(teacherData[i].staff._id)
                            }
                        }
                        for (var i = 0 ; i < registrarData.length ;i++){
                            if (registrars.indexOf(registrarData[i].staff._id) == -1){
                                registrars.push(registrarData[i].staff._id)
                            }
                        }
                        merge.push({s:{r:0,c:0}},{e:{r:0,c:100}})
                        merge.push({s:{r:8,c:0}},{e:{r:8,c:100}})
                        merge.push({s:{r:16,c:0}},{e:{r:16,c:100}})
                        merge.push({s:{r:24,c:0}},{e:{r:24,c:100}})
                        
                        for (var i = 0 ; i < teachers.length ; i++){
                            output[2].push('应续报')
                            output[2].push('实续报')
                            output[2].push('续报率')
                            output[10].push('应上课时')
                            output[10].push('实际课时')
                            output[10].push('出勤率')
                            output[18].push('试听学生')
                            output[18].push('转卡学生')
                            output[18].push('转卡率')
                            let thisTeacherData = teacherData.filter(e=>{return e.staff._id == teachers[i]})
                            thisTeacherData = thisTeacherData.sort((a,b)=>{return a.month - b.month})
                            for (var j = 0 ; j < 4; j++){
                                
                                if (j < 3){
                                    output[1 + j * 8].push(thisTeacherData[0].staff == undefined ? '未知' : thisTeacherData[0].staff.name)
                                    output[1 + j * 8].push('')
                                    output[1 + j * 8].push('')
                                }
                                else{
                                    output[25].push(thisTeacherData[0].staff == undefined ? '未知' : thisTeacherData[0].staff.name)
                                }
                            }
                            merge.push({s:{r:1,c:1 + 3* i }},{e:{r:1,c:3 * (i + 1)}})
                            merge.push({s:{r:9,c:1 + 3* i }},{e:{r:9,c:3 * (i + 1)}})
                            merge.push({s:{r:17,c:1 + 3* i }},{e:{r:17,c:3 * (i + 1)}})

                            for (var j = 0 ; j < quarters.length ; j++){
                                let index = thisTeacherData.map(e=>{return e.month}).indexOf(quarters[j] - 1)
                               
                                if (index == -1){
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 26].push('无')
                                }
                                else{
                                    output[j + 3].push(thisTeacherData[index].supposedContinueCount)
                                    output[j + 3].push(thisTeacherData[index].actualContinueCount)
                                    output[j + 3].push(thisTeacherData[index].continuePercentage)
                                    output[j + 11].push(thisTeacherData[index].supposedStudentCount)
                                    output[j + 11].push(thisTeacherData[index].actualStudentCount)
                                    output[j + 11].push(thisTeacherData[index].actualStudentPercentage)
                                    output[j + 19].push(thisTeacherData[index].newStudentCount)
                                    output[j + 19].push(thisTeacherData[index].convertCount)
                                    output[j + 19].push(thisTeacherData[index].convertPercentage)
                                    output[j + 26].push(thisTeacherData[index].studentCount)
                                }
                            }
                            if (thisTeacherData.length > 0){
                                let supposedContinueCount = thisTeacherData.map(e=>{return e.supposedContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualContinueCount = thisTeacherData.map(e=>{return e.actualContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let supposedStudentCount = thisTeacherData.map(e=>{return e.supposedStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualStudentCount = thisTeacherData.map(e=>{return e.actualStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let newStudentCount = thisTeacherData.map(e=>{return e.newStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let convertCount = thisTeacherData.map(e=>{return e.convertCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let studentCount = thisTeacherData.map(e=>{return e.studentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let continuePercentage = parseFloat((actualContinueCount || 0) / (supposedContinueCount || 1) * 100).toFixed(2)
                                let actualStudentPercentage = parseFloat((actualStudentCount || 0) / (supposedStudentCount || 1) * 100).toFixed(2)
                                let convertPercentage = parseFloat((convertCount || 0) / (newStudentCount || 1) * 100).toFixed(2)
                                output[6].push(supposedContinueCount,actualContinueCount,continuePercentage)
                                output[14].push(supposedStudentCount,actualStudentCount,actualStudentPercentage)
                                output[22].push(newStudentCount,convertCount,convertPercentage)
                                output[29].push(studentCount)
                            }
                            else{
                                output[6].push('无')
                                output[6].push('无')
                                output[6].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[29].push('无')
                            }
                        }

                            if (schoolData.length > 0){
                                output[2].push('应续报')
                                output[2].push('实续报')
                                output[2].push('续报率')
                                output[10].push('应上课时')
                                output[10].push('实际课时')
                                output[10].push('出勤率')
                                output[18].push('试听学生')
                                output[18].push('转卡学生')
                                output[18].push('转卡率')
                                for (var j = 0 ; j < 4; j++){
                                
                                if (j < 3){
                                    output[1 + j * 8].push('校区汇总')
                                    output[1 + j * 8].push('')
                                    output[1 + j * 8].push('')
                                }
                                else{
                                    output[25].push('校区汇总')
                                }
                            }
                                let lenlen = output[3].length
                                merge.push({s:{r:1,c:1 + lenlen }},{e:{r:1,c:lenlen + 3}})
                                merge.push({s:{r:9,c:1 + lenlen }},{e:{r:9,c:lenlen + 3}})
                                merge.push({s:{r:17,c:1 + lenlen }},{e:{r:17,c:lenlen + 3}})
                                for (var j = 0 ; j < quarters.length ; j++){
                                let index = schoolData.map(e=>{return e.month}).indexOf(quarters[j] - 1)
                                if (index == -1){
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 26].push('无')
                                }
                                else{
                                    output[j + 3].push(schoolData[index].supposedContinueCount)
                                    output[j + 3].push(schoolData[index].actualContinueCount)
                                    output[j + 3].push(schoolData[index].continuePercentage)
                                    output[j + 11].push(schoolData[index].supposedStudentCount)
                                    output[j + 11].push(schoolData[index].actualStudentCount)
                                    output[j + 11].push(schoolData[index].actualStudentPercentage)
                                    output[j + 19].push(schoolData[index].newStudentCount)
                                    output[j + 19].push(schoolData[index].convertCount)
                                    output[j + 19].push(schoolData[index].convertPercentage)
                                    output[j + 26].push(schoolData[index].studentCount)
                                }
                            }
                            if (schoolData.length > 0){
                                let supposedContinueCount = schoolData.map(e=>{return e.supposedContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualContinueCount = schoolData.map(e=>{return e.actualContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let supposedStudentCount = schoolData.map(e=>{return e.supposedStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualStudentCount = schoolData.map(e=>{return e.actualStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let newStudentCount = schoolData.map(e=>{return e.newStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let convertCount = schoolData.map(e=>{return e.convertCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let studentCount = schoolData.map(e=>{return e.studentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let continuePercentage = parseFloat((actualContinueCount || 0) / (supposedContinueCount || 1) * 100).toFixed(2)
                                let actualStudentPercentage = parseFloat((actualStudentCount || 0) / (supposedStudentCount || 1) * 100).toFixed(2)
                                let convertPercentage = parseFloat((convertCount || 0) / (newStudentCount || 1) * 100).toFixed(2)
                                output[6].push(supposedContinueCount,actualContinueCount,continuePercentage)
                                output[14].push(supposedStudentCount,actualStudentCount,actualStudentPercentage)
                                output[22].push(newStudentCount,convertCount,convertPercentage)
                                output[29].push(studentCount)
                            }
                            else{
                                output[6].push('无')
                                output[6].push('无')
                                output[6].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[29].push('无')
                            }
                        }


                            for (var i = 0 ; i < registrars.length ; i++){
                            output[2].push('应续报')
                            output[2].push('实续报')
                            output[2].push('续报率')
                            output[10].push('应上课时')
                            output[10].push('实际课时')
                            output[10].push('出勤率')
                            output[18].push('试听学生')
                            output[18].push('转卡学生')
                            output[18].push('转卡率')
                            let thisRegistrarData = registrarData.filter(e=>{return e.staff._id == registrars[i]})
                            thisRegistrarData = thisRegistrarData.sort((a,b)=>{return a.month - b.month})
                            for (var j = 0 ; j < 4; j++){
                                if (thisRegistrarData.length > 0){
                                    if (j < 3){
                                    output[1 + j * 8].push((thisRegistrarData[0].staff == undefined ? '未知' : thisRegistrarData[0].staff.name))
                                    output[1 + j * 8].push('')
                                    output[1 + j * 8].push('')
                                    }
                                    else{
                                        output[25].push(thisRegistrarData[0].staff == undefined ? '未知' : thisRegistrarData[0].staff.name)
                                    }
                                }
                                
                            }
                            merge.push({s:{r:1,c:1 + 3* i }},{e:{r:1,c:3 * (i + 1)}})
                            merge.push({s:{r:9,c:1 + 3* i }},{e:{r:9,c:3 * (i + 1)}})
                            merge.push({s:{r:17,c:1 + 3* i }},{e:{r:17,c:3 * (i + 1)}})

                            for (var j = 0 ; j < quarters.length ; j++){
                                let index = thisRegistrarData.map(e=>{return e.month}).indexOf(quarters[j] - 1)
                                if (index == -1){
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 3].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 11].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 19].push('无')
                                    output[j + 26].push('无')
                                }
                                else{
                                    output[j + 3].push(thisRegistrarData[index].supposedContinueCount)
                                    output[j + 3].push(thisRegistrarData[index].actualContinueCount)
                                    output[j + 3].push(thisRegistrarData[index].continuePercentage)
                                    output[j + 11].push(thisRegistrarData[index].supposedStudentCount)
                                    output[j + 11].push(thisRegistrarData[index].actualStudentCount)
                                    output[j + 11].push(thisRegistrarData[index].actualStudentPercentage)
                                    output[j + 19].push(thisRegistrarData[index].newStudentCount)
                                    output[j + 19].push(thisRegistrarData[index].convertCount)
                                    output[j + 19].push(thisRegistrarData[index].convertPercentage)
                                    output[j + 26].push(thisRegistrarData[index].studentCount)
                                }
                            }
                            if (thisRegistrarData.length > 0){
                                let supposedContinueCount = thisRegistrarData.map(e=>{return e.supposedContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualContinueCount = thisRegistrarData.map(e=>{return e.actualContinueCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let supposedStudentCount = thisRegistrarData.map(e=>{return e.supposedStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let actualStudentCount = thisRegistrarData.map(e=>{return e.actualStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let newStudentCount = thisRegistrarData.map(e=>{return e.newStudentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let convertCount = thisRegistrarData.map(e=>{return e.convertCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let studentCount = thisRegistrarData.map(e=>{return e.studentCount}).reduce((a,b)=>{return parseInt(a) + parseInt(b)})
                                let continuePercentage = parseFloat((actualContinueCount || 0) / (supposedContinueCount || 1) * 100).toFixed(2)
                                let actualStudentPercentage = parseFloat((actualStudentCount || 0) / (supposedStudentCount || 1) * 100).toFixed(2)
                                let convertPercentage = parseFloat((convertCount || 0) / (newStudentCount || 1) * 100).toFixed(2)
                                output[6].push(supposedContinueCount,actualContinueCount,continuePercentage)
                                output[14].push(supposedStudentCount,actualStudentCount,actualStudentPercentage)
                                output[22].push(newStudentCount,convertCount,convertPercentage)
                                output[29].push(studentCount)
                            }
                            else{
                                output[6].push('无')
                                output[6].push('无')
                                output[6].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[14].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[22].push('无')
                                output[29].push('无')
                            }
                        }
                        
                        console.log(output,'dssd')
                        //
                        excel.exportRaw(output,data.year + '年'+ (parseInt(data.quarter)+ 1)+ '季度报表')
                    }
                })
            },
            schoolSelected() {
      // this.getDepartmentList(1, 99999);
            var ob = this.schoolList.map(function(e){return e._id}).indexOf(this.school)
            this.school = this.schoolList[ob]._id
            if (this.schoolList[ob]._id == 'all'){
                this.getInitData('all')
            }
            else{
                this.getInitData(this.schoolList[ob]._id)
            }
            
    },

    changeDisplayType() {
      // this.getDepartmentList(1, 99999);
      this.display = this.display == 0 ? 1 : 0
      this.drawLine()
    },
            getSchoolList(page, pageSize) {



      let data = {};
      (data.page = page), (data.pageSize = pageSize);
      request({
        url: "/school/getSchoolList",
        method: "post",
        data
      }).then(res => {
        // this.school = this.info.school[0]._id
        this.schoolList = [{name:'全部',_id:'all'}]
        this.schoolList = this.schoolList.concat(res.data.school)
        // 返回数据
      });


    },
        },


        created() {

            this.queryOption.start_time = getLastMonthDate()

            this.queryOption.end_time = getTodayDate()
            this.school = this.info.school[0]._id
            this.schoolname = this.info.school[0].name
            // this.getInitData(this.info.school[0]._id)
            if (( this.info.school[0].headquarter == 1) || ( this.info.school[0].headquarter == 2)){
                this.headquarter = true
                this.getSchoolList(1,99999)

            }


  }


        
}
</script>
<style lang="scss" scoped>
.page {
  .logo {
    width: 120px;
  }
  .btn-group {
    color: $color-text-placehoder;
    font-size: 12px;
    margin-top: 0px;
    margin-bottom: 20px;
    .btn-group__btn {
      color: $color-text-sub;
      &:hover {
        color: $color-text-main;
      }
      &.btn-group__btn--link {
        color: $color-primary;
      }
    }
  }
}
</style>